import { expect } from 'chai';

import {CoverageRate} from '../../src/test-parser'
import {JaCoCoParser} from '../../src/parsers/jacoco'


describe('parse', () => {

    it('should return coverage ratio correctly', async () => {

        const expectedCoverageRatio: CoverageRate = {
            instructionCoverageRate: 60.52,
            branchCoverageRate: 42.31,
            lineCoverageRate: 59.57,
            methodCoverageRate: 54.89,
            classCoverageRate: 64
        };

        const jacocoParser = new JaCoCoParser();
        const coverageRatio = await jacocoParser.parse('./test/resources/jacoco.html');
        expect(coverageRatio).to.deep.equal(expectedCoverageRatio);
    });
});